<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>


    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Contacto</title>
        <link href="/css/style.css" rel="stylesheet" type="text/css" />

        <script language=" JavaScript" type="text/javascript">            

            function comprobarcamposobligatorios(){
                var p= document.getElementsByName("nombre");            
                var r= document.getElementsByName("correo");
                if(p[0].value == 0 ||r[0].value == 0 ){
                    alert("Introduce los campos obligatorios");
                }
            }
        </script>
    </head>

    <body>
        <h1>
            <form action="ir_portada">
                <input type="image" src="stylesheets/fondo_admin.jpg" >
            </form>

            <br>
            <center>Contacto</center>
        </h1>
        <div id="centrado3">
            <table>
                <tr>
                    <td>
                        <form  action="/crear_mensaje" method="post">

                            <fieldset>
                                <legend><b>Nuevo usuario</b></legend>
                                <table>
                                    <tr>
                                        <td>*Nombre: </td>
                                        <td><input name="nombre" type="text"/></td>
                                    </tr>

                                    <tr>
                                        <td>Teléfono:</td>
                                        <td><input type="text" name="telefono"/></td>
                                    </tr>

                                    <tr>
                                        <td>*Correo Electrónico:</td>
                                        <td><input type="text" name="correo"></td>
                                    </tr>

                                    <tr>
                                        <td>Comentario:</td>
                                        <td><textarea name="comentarios" rows="3" cols="60"></textarea></td>
                                    </tr>
                                </table>
                                <br>
                                (*Campos obligatorios)                  <input align="right" type="submit" onclick="comprobarcamposobligatorios()" value="Enviar" >
                            </fieldset>
                        </form>
                </tr>
            </table>

        </div>

    </body>
</html>